﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Threading;
using System.Globalization;
using Nivdal.AuxCode;

namespace Nivdal
{
    public partial class Survey : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = Resources.Resource.Default_PageTitle + ", " + Resources.Resource.Survey_PageTitle;
            GetNivdalData.GetNivdalData GND = new GetNivdalData.GetNivdalData();
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
                Response.Redirect("~/Default.aspx");
            OnlineUser ou = (OnlineUser)Session["User"];

            if (!IsPostBack)
            {               
                if (GND.ReadNivdalBoolData("UserId", "Nivdal_SurveyDidUserAnswerSurvey", ou.UserId))
                    SurveyPanelStep1.Visible = false;
                else
                    SurveyCompletedPanel.Visible = false;
            }
        }

        private string FormatBoolForSQL(bool b)
        {
            if (b) return ("1");
            return ("0");
        }

        protected void SubmitButtonClick(object sender, EventArgs e)
        {
            GetNivdalData.GetNivdalData GND = new GetNivdalData.GetNivdalData();
            string UserId = GND.ReturnUserId();
            bool AllFine = true;
            string ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            using (SqlConnection conn = new SqlConnection(ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("Nivdal_SurveySendAnswer", conn);
                cmd.CommandType = CommandType.StoredProcedure;               

                // Question 1
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "1");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q1A1RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q1A2RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q1A3RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q1A4RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q1A5RadioButton.Checked));
                cmd.Parameters.AddWithValue("FreeText", Q1FreeTextTextBox.Text.Trim());

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 1<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 2
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "2");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q2A1RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q2A2RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q2A3RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q2A4RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q2A5RadioButton.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 2<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 3
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "3");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q3A1RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q3A2RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q3A3RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q3A4RadioButton.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 3<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 4
                //cmd.Parameters.AddWithValue("UserId", UserId);
                //cmd.Parameters.AddWithValue("QuestionId", "4");
                //cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q4A1CheckBox.Checked));
                //cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q4A2CheckBox.Checked));
                //cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q4A3CheckBox.Checked));
                //cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q4A4CheckBox.Checked));
                //cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q4A5CheckBox.Checked));
                //cmd.Parameters.AddWithValue("FreeText", Q4FeeTextTextBox.Text.Trim());

                //try
                //{
                //    conn.Open();
                //    cmd.ExecuteNonQuery();
                //}
                //catch
                //{
                //    ErrorLabel.Text += "Error in question 4<br/>";
                //    AllFine = false;
                //}
                //finally { conn.Close(); }
                //cmd.Parameters.Clear();

                // Question 5
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "5");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q5_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q5_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q5_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q5_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q5_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q5_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q5_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 5<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 6
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "6");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q6_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q6_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q6_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q6_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q6_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q6_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q6_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 6<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 7
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "7");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q7_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q7_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q7_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q7_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q7_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q7_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q7_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 7<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                // Question 8
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "8");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q8_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q8_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q8_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q8_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q8_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q8_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q8_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 8<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 9
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "9");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q9_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q9_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q9_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q9_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q9_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q9_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q9_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 9<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 10
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "10");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q10_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q10_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q10_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q10_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q10_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q10_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q10_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 10<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                // Question 11
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "11");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q11_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q11_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q11_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q11_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q11_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q11_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q11_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 11<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                // Question 12
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "12");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q12_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q12_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q12_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q12_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q12_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q12_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q12_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 12<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                // Question 13
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "13");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q13_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q13_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q13_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q13_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q13_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q13_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q13_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 13<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                // Question 14
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "14");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q14_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q14_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q14_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q14_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q14_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q14_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q14_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 14<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                // Question 15
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "15");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q15_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q15_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q15_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q15_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q15_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q15_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q5_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 15<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                //Question 22
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "22");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q22_1RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q22_2RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q22_3RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q22_4RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q22_5RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q22_6RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q22_7RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 22<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 93
                
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "93");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q93A1RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q93A2RadioButton.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 93<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 94
                if (Q93A2RadioButton.Checked)
                {
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "94");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q94A1CheckBox.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q94A2CheckBox.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q94A3CheckBox.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q94A4CheckBox.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q94A5CheckBox.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q94A6CheckBox.Checked));
                    cmd.Parameters.AddWithValue("FreeText", Q94FreeTextTextBox.Text.Trim());

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 94<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                }

                // Question 16
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "16");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q16A1CheckBox.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q16A2CheckBox.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q16A3CheckBox.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q16A4CheckBox.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q16A5CheckBox.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q16A6CheckBox.Checked));
		        cmd.Parameters.AddWithValue("FreeText", Q16FreeTextTextBox.Text.Trim() );

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 16<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                
                // Question 17
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "17");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL("1" == Q17DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL("2" == Q17DDL.SelectedValue));
                
                
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 17<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                
                // Question 18
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "18");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL("1" == Q18DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL("2" == Q18DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL("3" == Q18DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL("4" == Q18DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL("5" == Q18DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL("6" == Q18DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL("6" == Q18DDL.SelectedValue));


                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 18<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                
                // Question 19
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "19");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL("1" == Q19DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL("2" == Q19DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL("3" == Q19DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL("4" == Q19DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL("5" == Q19DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL("6" == Q19DDL.SelectedValue));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL("7" == Q19DDL.SelectedValue));


                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 19<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                // Question 20
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "20");
                cmd.Parameters.AddWithValue("FreeText", Q20TextBox.Text.Trim());

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 20<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                

                // Question 23
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "23");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q23A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q23A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q23A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q23A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q23A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q23A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q23A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 3<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 24
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "24");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q24A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q24A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q24A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q24A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q24A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q24A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q24A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 24<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 25
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "25");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q25A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q25A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q25A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q25A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q25A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q25A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q25A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 25<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 26
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "26");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q26A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q26A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q26A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q26A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q26A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q26A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q26A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 26<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 91
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "91");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q91A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q91A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q91A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q91A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q91A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q91A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q91A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 91<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 92
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "92");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q92A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q92A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q92A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q92A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q92A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q92A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q92A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 91<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // question 27
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "27");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q27A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q27A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q27A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q27A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q27A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q27A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q27A7_RB.Checked));
                cmd.Parameters.AddWithValue("FreeText", Q27FreeTextbox.Text.Trim());

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 27<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 28
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "28");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q28A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q28A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q28A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q28A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q28A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q28A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q28A7_RB.Checked));
                cmd.Parameters.AddWithValue("FreeText", Q28FreeTextbox.Text.Trim());

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 28<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                if (AllFine)
                {
                    SurveyPanelStep1.Visible = false;
                    SurveyPanelStep2.Visible = true;
                }
            }
        }

        protected void Submit2ButtonClick(object sender, EventArgs e)
        {
            GetNivdalData.GetNivdalData GND = new GetNivdalData.GetNivdalData();
            string UserId = GND.ReturnUserId();
            bool AllFine = true;
            string ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            using (SqlConnection conn = new SqlConnection(ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("Nivdal_SurveySendAnswer", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                // Question 21
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "21");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q21A1RadioButton.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q21A2RadioButton.Checked));
                cmd.Parameters.AddWithValue("FreeText", Q21FReeTextTextBox.Text.Trim());
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 21<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 30
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "30");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q30A1CheckBox.Checked));
                cmd.Parameters.AddWithValue("FreeText",  Q30TextBox.Text.Trim());
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 30<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 40
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "40");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q40A1CheckBox.Checked));
                cmd.Parameters.AddWithValue("FreeText", Q40TextBox.Text.Trim());
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 40<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 50
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "50");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q50A1CheckBox.Checked));
                cmd.Parameters.AddWithValue("FreeText", Q50TextBox.Text.Trim());
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 50<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                if (Q30TextBox.Text.Trim().Length > 0)
                {
                    // Q31
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "31");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q31A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q31A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q31A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q31A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q31A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q31A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q31A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 31<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    
                    // Q32
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "32");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q32A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q32A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q32A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q32A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q32A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q32A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q32A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 31<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q33
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "33");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q33A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q33A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q33A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q33A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q33A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q33A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q33A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 33<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q34
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "34");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q34A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q34A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q34A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q34A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q34A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q34A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q34A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 34<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q35
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "35");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q35A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q35A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q35A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q35A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q35A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q35A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q35A7_RB.Checked));
                    cmd.Parameters.AddWithValue("FreeText", Q35FreeTextbox.Text.Trim());

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 35<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q36
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "36");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q36A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q36A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q36A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q36A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q36A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q36A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q36A7_RB.Checked));
                    cmd.Parameters.AddWithValue("FreeText", Q36FreeTextbox.Text.Trim());

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 36<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                }

                if (Q40TextBox.Text.Trim().Length > 0)
                {
                    // Q41
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "41");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q41A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q41A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q41A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q41A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q41A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q41A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q41A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 41<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();

                    // Q42
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "42");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q42A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q42A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q42A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q42A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q42A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q42A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q42A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 42<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q43
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "43");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q43A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q43A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q43A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q43A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q43A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q43A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q43A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 43<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q44
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "44");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q44A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q44A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q44A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q44A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q44A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q44A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q44A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 44<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q45
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "45");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q45A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q45A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q45A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q45A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q45A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q45A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q45A7_RB.Checked));
                    cmd.Parameters.AddWithValue("FreeText", Q45FreeTextbox.Text.Trim());

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 45<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q46
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "46");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q46A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q46A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q46A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q46A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q46A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q46A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q46A7_RB.Checked));
                    cmd.Parameters.AddWithValue("FreeText", Q46FreeTextbox.Text.Trim());

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 46<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                }
                if (Q50TextBox.Text.Trim().Length > 0)
                {
                    // Q51
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "51");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q51A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q51A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q51A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q51A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q51A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q51A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q51A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 51<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();

                    // Q52
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "52");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q52A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q52A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q52A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q52A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q52A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q52A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q52A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 51<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q53
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "53");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q53A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q53A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q53A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q53A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q53A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q53A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q53A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 53<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q54
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "54");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q54A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q54A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q54A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q54A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q54A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q54A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q54A7_RB.Checked));

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 54<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q55
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "55");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q55A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q55A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q55A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q55A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q55A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q55A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q55A7_RB.Checked));
                    cmd.Parameters.AddWithValue("FreeText", Q55FreeTextbox.Text.Trim());

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 55<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                    // Q56
                    cmd.Parameters.AddWithValue("UserId", UserId);
                    cmd.Parameters.AddWithValue("QuestionId", "56");
                    cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q56A1_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q56A2_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q56A3_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q56A4_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q56A5_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q56A6_RB.Checked));
                    cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q56A7_RB.Checked));
                    cmd.Parameters.AddWithValue("FreeText", Q56FreeTextbox.Text.Trim());

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                    catch
                    {
                        ErrorLabel.Text += "Error in question 56<br/>";
                        AllFine = false;
                    }
                    finally { conn.Close(); }
                    cmd.Parameters.Clear();
                }
                //Question 61
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "60");
                cmd.Parameters.AddWithValue("FreeText", Q60TextBox.Text.Trim());
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 60<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                //Question 62
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "61");
                cmd.Parameters.AddWithValue("FreeText", Q61TextBox.Text.Trim());
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 61<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question71 
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "71");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q71A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q71A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q71A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q71A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q71A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q71A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q71A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 71<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question72 
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "72");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q72A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q72A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q72A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q72A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q72A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q72A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q72A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 72<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question73 
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "73");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q73A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q73A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q73A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q73A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q73A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q73A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q73A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 72<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question74 
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "74");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q74A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q74A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q74A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q74A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q74A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q74A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q74A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 74<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question75 
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "75");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q75A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q75A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q75A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q75A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q75A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q75A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q75A7_RB.Checked));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 75<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question76 
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "76");
                cmd.Parameters.AddWithValue("Answer1Selected", FormatBoolForSQL(Q76A1_RB.Checked));
                cmd.Parameters.AddWithValue("Answer2Selected", FormatBoolForSQL(Q76A2_RB.Checked));
                cmd.Parameters.AddWithValue("Answer3Selected", FormatBoolForSQL(Q76A3_RB.Checked));
                cmd.Parameters.AddWithValue("Answer4Selected", FormatBoolForSQL(Q76A4_RB.Checked));
                cmd.Parameters.AddWithValue("Answer5Selected", FormatBoolForSQL(Q76A5_RB.Checked));
                cmd.Parameters.AddWithValue("Answer6Selected", FormatBoolForSQL(Q76A6_RB.Checked));
                cmd.Parameters.AddWithValue("Answer7Selected", FormatBoolForSQL(Q76A7_RB.Checked));
                cmd.Parameters.AddWithValue("FreeText", Q76FreeTextbox.Text.Trim());
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 76<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // Question 80
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "80");
                cmd.Parameters.AddWithValue("FreeText", Q80TextBox.Text.Trim());
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question 80<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();
                // Question 81
                cmd.Parameters.AddWithValue("UserId", UserId);
                cmd.Parameters.AddWithValue("QuestionId", "81");
                cmd.Parameters.AddWithValue("FreeText", Q81TextBox.Text.Trim());
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    ErrorLabel.Text += "Error in question81<br/>";
                    AllFine = false;
                }
                finally { conn.Close(); }
                cmd.Parameters.Clear();

                // The end!!
                
            }
            if (AllFine)
            {
                SurveyPanelStep2.Visible = false;
                Response.Redirect("~/TeamHomePage.aspx");
            }
        }
    }
}